package com.zhongshan.ga.mobile.resource;

import java.io.IOException;

import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;

import com.google.gson.JsonObject;
import com.zhongshan.ga.logger.GenerateLog;
import com.zhongshan.ga.mobile.logic.GetScenicSpotsCommentListLogic;



/**
 * 获得景点评论资源类
 * @author yanqi
 *
 */
public class GetScenicSpotsCommentListResource extends ServerResource {
	@Get
	public Representation getScenicSpotsCommentList(Representation entity) throws IOException {
		GenerateLog.outDebug("调用了获得景点评论列表的方法");
		entity = postScenicSpotsCommentList(entity);
		return entity;
	}
	
	@Post
	public Representation postScenicSpotsCommentList(Representation entity) throws IOException {
		GenerateLog.outDebug("调用了获得景点评论列表的方法");
		if (entity == null) {
			return new StringRepresentation("访问有误");
		}
		
		GetScenicSpotsCommentListLogic scenicSpotsCommentListLogic = new GetScenicSpotsCommentListLogic();
		JsonObject resultJsonObject = scenicSpotsCommentListLogic.getScenicSpotsCommentList(entity);
		Representation representation = new StringRepresentation(resultJsonObject.toString());
		return representation;
	}
}
